#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
int main(int argc, char* argv[])
{
int pid;
pid = fork();
switch (pid)
	{
		case -1:
		{
			puts("fork error");
			return 1;
		} 	
		case 0:
		{
			puts("I'm child");
			execl("./hello_world", "", "child", NULL);
			break;
		} 
		default:
		{
			puts("I'm parent. I'm waiting for child exit.");
			int status;
			waitpid(pid, &status, 0);
			if (WIFEXITED(status))
		{
			printf("The child exited normally with, status = %d\n", WEXITSTATUS(status)); 
		}
	
		else
		{
			printf("The child exited with problem");
		}
		execl("./hello_world", "", NULL, NULL);
		}
	}
}